package com.keyinong.parkin.mall.adapter;

import java.util.ArrayList;
import java.util.HashMap;

import com.example.parkin.R;
import com.keyinong.parkin.home.bean.AddressBean;
import com.keyinong.parkin.home.bean.ParkinBean;
import com.keyinong.parkin.mall.bean.MallTypeBean;
import com.keyinong.parkin.mall.bean.ShopBean;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

public class MallShopAdapter extends BaseAdapter {
	Context context;
	ArrayList<ShopBean> list;
	int isindex = 0;

	public MallShopAdapter(Context context,
			ArrayList<ShopBean> list) {
		super();
		this.context = context;
		this.list = list;
	}

	public void setindex(int isindex) {
		this.isindex = isindex;
	}

	@Override
	public int getCount() {

		return list.size();
	}

	@Override
	public Object getItem(int position) {

		return list.get(position);
	}

	@Override
	public long getItemId(int position) {

		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		ViewHandle handle = null;
		if (view == null) {
			handle = new ViewHandle();
			view = LayoutInflater.from(context).inflate(
					R.layout.item_list_shop, null);
			handle.img_shopLogo = (ImageView) view.findViewById(R.id.img_shopLogo);
			handle.tv_shopName = (TextView) view.findViewById(R.id.tv_shopName);
			handle.tv_shopType = (TextView) view.findViewById(R.id.tv_shopType);
			handle.tv_startPrice = (TextView) view.findViewById(R.id.tv_startPrice);
			view.setTag(handle);
		} else {
			handle = (ViewHandle) view.getTag();
			
		}
		handle.tv_shopName.setText(list.get(position).getName());
		handle.tv_startPrice.setText(list.get(position).getStartSend()+"");
		return view;
	}

	private class ViewHandle {
		ImageView img_shopLogo;
		TextView tv_shopName;
		TextView tv_shopType;
		TextView tv_startPrice;
		
	}
}
